package com.mingqijia.gassafety.authority.api.req.resource;

import com.mingqijia.gassafety.shared.constant.Constants;
import com.mingqijia.gassafety.shared.cqrs.AuthoritySupportReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/***
 * @author Damon S.
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "新建功能按钮参数")
public final class CreateFuncResourceReqDTO extends AuthoritySupportReq implements Serializable {

    @NotNull(message = "名称应满足1-50位汉字、字母、数字、符号")
    @ApiModelProperty(value = "资源名称", required = true)
    @Pattern(regexp = "^[^\\s]{1,50}$", message = "名称应满足1-50位汉字、字母、数字、符号")
    private String name;

    @ApiModelProperty(value = "父级资源(菜单)ID")
    private String parentId;

    @ApiModelProperty(value = "访问路径")
    @Pattern(regexp = Constants.REGEXP_URL, message = "请输入2000之内的字符")
    private String url;

    @NotNull(message = "请设置功能编码")
    @ApiModelProperty(value = "功能编码", required = true)
    private String funcCode;
}
